package com.sc.controller;

import com.sc.controller.vo.*;
import com.sc.entity.Warehouse;
import com.sc.service.OrdersService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author 许一
 * @since 2023-12-08 11:38:15
 */
@Controller
@RequestMapping("/orders")
public class OrdersController {
    @Resource
    private OrdersService ordersService;

    @GetMapping("/getLineList")
    @ResponseBody
    public OrderLineChartVO getLineList(@RequestParam("warehouseId")  Long id) {
        OrderLineChartVO orderLineChartVO = ordersService.getLineList(id);
        return orderLineChartVO;
    }

    @GetMapping("/getPieList")
    @ResponseBody
    public List<OrderPieChartVO> getPieList(@RequestParam("warehouseId")  Long id) {
        List<OrderPieChartVO> orderPieChartVOS = ordersService.getPieList(id);
        return orderPieChartVOS;
    }

    @GetMapping("/getHistogram")
    @ResponseBody
    public OrderHistogramVO getHistogram(@RequestParam("warehouseId")  Long id) {
        OrderHistogramVO orderHistogramVO = ordersService.getHistogram(id);
        return orderHistogramVO;
    }

    @GetMapping("/getSum")
    @ResponseBody
    public OrderSumVO getSum(@RequestParam("warehouseId")  Long id) {
        OrderSumVO orderSumVO = ordersService.getSum(id);
        return orderSumVO;
    }

    //出库率
    @GetMapping("/getOutboundRate")
    @ResponseBody
    public List<OrderOutboundRateVO> getOutboundRate(@RequestParam("warehouseId")  Long id) {
        List<OrderOutboundRateVO>  orderOutboundRateVOS = ordersService.getOutboundRate(id);
        return orderOutboundRateVOS;
    }

    //上一小时工作量
    @GetMapping("/getWorkload")
    @ResponseBody
    public List<OrderVolumeVO> getWorkload(@RequestParam("warehouseId")  Long id) {
        List<OrderVolumeVO>  orderVolumeVOS = ordersService.getWorkload(id);
        return orderVolumeVOS;
    }

}
